﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FluentValidation.Validators;

using CloudSoft.Extensions;

namespace ERPStore.Validators
{
	public class NotNullOrTrimmedEmptyValidator<T> : PropertyValidator
	{
		public NotNullOrTrimmedEmptyValidator()
			: base("Property {PropertyName} is null or empty")
		{

		}

		protected override bool IsValid(PropertyValidatorContext context)
		{
			var input = context.PropertyValue as string;

			if (input.IsNullOrTrimmedEmpty())
			{
				return false;
			}

			return true;
		}
	}
}
